home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / stl / stl_ctraits_fns.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-08  |  2.1 KB  |  70 lines

  1. /*
  2.  * Copyright (c) 1999
  3.  * Silicon Graphics Computer Systems, Inc.
  4.  *
  5.  * Permission to use, copy, modify, distribute and sell this software
  6.  * and its documentation for any purpose is hereby granted without fee,
  7.  * provided that the above copyright notice appear in all copies and
  8.  * that both that copyright notice and this permission notice appear
  9.  * in supporting documentation.  Silicon Graphics makes no
  10.  * representations about the suitability of this software for any
  11.  * purpose.  It is provided "as is" without express or implied warranty.
  12.  */ 
  13.  
  14. // WARNING: This is an internal header file, included by other C++
  15. // standard library headers.  You should not attempt to use this header
  16. // file directly.
  17.  
  18. #ifndef __SGI_STL_INTERNAL_CTRAITS_FUNCTIONS_H
  19. #define __SGI_STL_INTERNAL_CTRAITS_FUNCTIONS_H
  20.  
  21. // This file contains a few small adapters that allow a character
  22. // traits class to be used as a function object.
  23.  
  24. __STL_BEGIN_NAMESPACE
  25.  
  26. template <class _Traits>
  27. struct _Eq_traits
  28.   : public binary_function<typename _Traits::char_type,
  29.                            typename _Traits::char_type,
  30.                            bool>
  31. {
  32.   bool operator()(const typename _Traits::char_type& __x,
  33.                   const typename _Traits::char_type& __y) const
  34.     { return _Traits::eq(__x, __y); }
  35. };
  36.  
  37. template <class _Traits>
  38. struct _Eq_int_traits
  39.   : public binary_function<typename _Traits::char_type,
  40.                            typename _Traits::int_type,
  41.                            bool>
  42. {
  43.   bool operator()(const typename _Traits::char_type& __x,
  44.                   const typename _Traits::int_type& __y) const
  45.     { return _Traits::eq_int_type(_Traits::to_int_type(__x), __y); }
  46. };
  47.  
  48. template <class _Traits>
  49. struct _Lt_traits
  50.   : public binary_function<typename _Traits::char_type,
  51.                            typename _Traits::char_type,
  52.                            bool>
  53. {
  54.   bool operator()(const typename _Traits::char_type& __x,
  55.                   const typename _Traits::char_type& __y) const
  56.     { return _Traits::lt(__x, __y); }
  57. };
  58.  
  59. __STL_END_NAMESPACE
  60.  
  61. #endif /* __SGI_STL_INTERNAL_CTRAITS_FUNCTIONS_H */
  62.  
  63. // Local Variables:
  64. // mode:C++
  65. // End:
  66.  
  67.  
  68.  
  69.  
  70.